package org.example.dao.user;


import org.apache.ibatis.annotations.*;
import org.example.entity.User;

import java.util.List;

@Mapper
public interface UserMapper {




    @Select("select * from user")
    List<User> list();

    @Delete("delete from user where user_id = #{userId}")
    boolean delete(int userId);

    @Insert("insert into user(username, gender, password, phone, name) values (#{username},#{gender}," +
            "#{password},#{phone},#{name})")
    void add(User user);

    @Update("update user set username = #{username},password=#{password},gender=#{gender},name=#{name},phone=#{phone} " +
            "where user_id = #{userId}")
    void update(User user);

    @Select("select count(*) from user")
    int listSize();

    List<User> listByPage(int pageSize, int page);

    List<User> listByReason(Integer userId,String username,String gender,String phone,String name);

    @Select("select * from user where username = #{username} and password = #{password}")
    User getUserByIdAndPassword(User user);
}
